"""
URL configuration for myproject project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from blog.views import HomePageView

''' blog 子路由'''
from django.contrib import admin
from django.urls import path, re_path
from blog import views
import blog.api_views as api_views

urlpatterns = [
    # path('admin/', admin.site.urls),
    # path('hello/',views.hello),
    # #进入博客主页
    # path("",views.index,name="index"),
    path("index/",views.blog_index,name="blog_index"),
    #文章访问: blog/article/list; blog/article/detail/1/
    path("article/list/",views.article_list,name="article_list"),
    path("article/list2/",views.article_list2,name="article_list"),
    path("article/detail/<int:article_id>/",views.article_detail,name="article_detail"),
    ##年月正则匹配 archive/{year}/{month}
    re_path(r'^archive/(?P<year>\d{4})/(?P<month>\d{1,2})/$',views.archive,name="archive"),
    #6.1 模板基础与变量渲染
    path("artile_profile/",views.article_profile,name="artile_profile"),
    #6.2 模板继承与模板块
    path("article_list3/",views.article_list3,name="article_list3"),
    #**6.3 模板继承与组件复用**
    path("template_re_use/",views.template_re_use,name="template_re_use"),
    #验证静态加载的内容
    path("verify_static/",views.verify_static,name="verify_static"),

    # **6.5 文章列表展现综合练习**
    path("my_article/", views.my_article_list, name="my_article_list"),
    # 7.6 文章列表—模型综合练习**
    path("articles_from_db/", views.articles_from_db, name="articles_from_db"),
    #第八章 django RESTful API接口设计
    path("api/hello/", api_views.HelloApi.as_view(), name="hello"),
    #'''8.2 API接口GET请求及参数解析'''
    path("api/get/params/",api_views.GetParserParam.as_view(),name="get_parser_param"),

    # 8.3 API接口POST请求及参数解析
    path("api/post/params/",api_views.PostParserParam.as_view(),name="post_parser_param"),
    #'''8.4 API接口响应结果数据封装'''
    path("api/response/result/",api_views.ResponseDataFormat.as_view(),name="api_response_result"),

    #'''8.5 序列化与反序列化深度应用'''
    path("api/article/submit/",api_views.ArticleForm.as_view(),name="api_serializer"),

    # 8.6 API接口数据与前端异步交互案例
    path("to_article/page",api_views.ArticleView.as_view(),name="api_article_list"),
    # 8.7 API接口数据与前端异步交互案例
    path("api/article/list/", api_views.ArticleList.as_view(), name="api_article_list"),
    #9.1 用户认证基础：登录、登出与权限控制
    path("user_login/",views.user_login,name="user_login"),
    #主页
    path("home/",views.home,name="home"),
    #退出
    path("logout/",views.user_logout,name="user_logout"),
    #9.4 自定义安全中间件：拦截未登录用户
    path("to_login/",views.to_login,name="to_login"),
    path("login/",views.UserLogin.as_view(),name="login"),
    path("to_home/",views.to_home,name="to_home"),
    path("to_home2/", views.to_home2, name="to_home2"),
    path("to_home3/", views.to_home3, name="to_home3"),
    # 智能生成的界面
    path("to_ai_login/", views.to_ai_login, name="to_ai_login"),
    path("to_ai_menu/", views.to_ai_menu, name="to_ai_menu"),
    path("to_main_page/", views.to_main_page, name="to_main"),
    path("to_list_page/", views.to_list_page, name="to_list_page"),
    path("to_operate_log/", views.to_operate_log, name="to_operate_log"),
    path("to_operate_log2/", views.to_operate_log2, name="to_operate_log2"),
    #用户操作日志log
    path("api/user/operate_log/",views.UserOperateLog.as_view(),name="user_operate_log"),
    # #############
    ########## demo样例 ############
    path("select_tree/",views.to_select_tree,name="to_demo_list"),
    # to_iframe
    path("to_iframe/",views.to_iframe,name="to_iframe"),
    # 主页面
    path("to_main/",views.to_main,name="to_main"),



]